import { ref } from 'vue'
import { defineStore } from 'pinia'
import type { UserType } from '@/types/user'
import { NOT_LOGIN } from '@/access/accessEnum'

export const useUserStore = defineStore('user', () => {
  //登录用户信息
  const loginUser = ref<UserType>({
    userName: '未登录',
    userRole: NOT_LOGIN,
  })
  //设置登录用户信息
  const setLoginUser = (userMess: UserType) => {
    loginUser.value = userMess
  }

  return { loginUser, setLoginUser }
})
